#!/usr/bin/env bash

ns_list=`kubectl get ns | awk 'NR>1{print $1}'`

for ns in ${ns_list}
do
#   echo ${ns}
   podlist=`kubectl get pod -n ${ns} | grep Terminating | awk '{print $1}'`
   for pod_name in ${podlist}
   do
      echo ${ns}/${pod_name}
      kubectl delete pod ${pod_name} --grace-period=0 --force -n ${ns}
   done

done

#podlist=`kubectl get pod --all-namespaces | grep Terminating | awk {'print $2'}`
#kubectl delete pod $podlist --grace-period=0 --force